package com.amigo.online.provider.ffmpeg.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amigo.online.provider.ffmpeg.rocketmq.consumer.VideoAddWatermarkConsumer;
import com.amigo.online.provider.ffmpeg.rocketmq.model.BaseMqSendModel;
import com.amigo.online.provider.ffmpeg.service.FfmpegService;


@RestController
@RequestMapping(value = "/ffmpeg", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class FfmpegController {

    @Autowired
    FfmpegService ffmpegService;

    @Autowired
    VideoAddWatermarkConsumer videoAddWatermarkConsumer;

    @PostMapping(value = "/video/addWatermark")
    public void ffmpegvideoConvert(@RequestBody Map<String, Object> videoMap) {
        ffmpegService.videoAddWaterMarkAndGetMusic(videoMap);
    }


    @PostMapping(value = "/test/video/addWatermark")
    public void ffmpegvideoConvertTest(@RequestBody Map<String, Object> videoMap) {
        BaseMqSendModel obj = new BaseMqSendModel();
        obj.setSendContentBean(videoMap);
        obj.setKeys("123123");
        obj.setTag("VIDEO");
        obj.setBeanName("sadsfsaf");
        videoAddWatermarkConsumer.handleMessage(obj);
    }

    @PostMapping(value = "/test/video")
    public void testFfmpegvideo(@RequestBody String account) {
        ffmpegService.TestVideoHandle(account);
    }

}
